package com.override_重写;

public class override02 {
    //重写中返回值类型的继承，父类返回值类型为Object，子类返回值类型为String 因为Object是所有类的父类，即父类返回值类型为Object，子类返回值类型为String
    public static void main(String[] args) {
        dog2 dog = new dog2();
        dog.eat();

    }
}

class animal2{
    public Object eat(){
        System.out.println("animal eat");
        return null;
    }
}

class dog2 extends animal2{
    public String eat(){ //
        System.out.println("dog eat");
        return null;
    }
}